Conventionally, various games have been developed in which a player object operated by a player is moving on a map or a course. In order to enhance the diversity of games, it is desirable to provide the player with a plurality of such maps or courses. In conventional game machines, such maps or courses are automatically generated.
In an image generating device disclosed in Japanese Patent Laid-Open Publication No. 11-144087 (1999-144087), a course for a race game or the like is automatically generated. Specifically, crucial parts, such as overhead crossings or straights, are first disposed, and course parts are then randomly selected and disposed, thereby generating a course. In a game machine disclosed in Japanese Patent Laid-Open Publication No. 2000-107441, a map is extracted depending on the degree of difficulty of a game. Specifically, a plurality of patterns of maps with rooms and passages disposed in advance thereon are provided, and one of these patterns is extracted depending on the degree of difficulty of the game. In a video game machine disclosed in Japanese Patent No. 3270929, a maze is automatically generated. Specifically, a main passage is first disposed, and then branching passages are generated and rooms are disposed at their dead ends to generate a maze.
However, the above conventional techniques have the following problems.
(1) In Japanese Patent Laid-Open Publication No. 11-144087 (1999-144087), a closed circular course used in a race game or the like is generated. Therefore, parts other than course parts, such as rooms, are difficult to set, which makes it impossible to set dead ends and branching passages.
(2) In Japanese Patent Laid-Open No. 2000-107441, selection is made from the fixed maps set. Therefore, random diversity is limited.
(3) In Japanese Patent No. 3270929, rooms are provided only to the dead ends of the branching passages. Therefore, rooms are not generated at, for example, some point on any passages. Thus, map diversity that could be achieved by a combination of passages and rooms is limited.
As described above, the map and the course in the conventional art lack diverse elements including elements of randomness. Moreover, maps and courses that can be generated are limited.
Alternatively, a map can be generated by randomly combining units of a plurality of types. Of these units of the plurality of types, some are preferably disposed relatively more, but some are preferably disposed relatively less. However, there have been no techniques so far in consideration of a ratio of the units of two types. Moreover, of these units, some are preferably adjacent to each other, but some are preferably not. However, there have been no techniques so far of randomly combining units in consideration of an affinity between adjacent units.
Therefore, a feature of an exemplary illustrative embodiment is to provide a game machine and a storage medium having stored therein a game program for automatically generating a map with diverse elements including elements of randomness in consideration of a ratio of units of two types and an affinity between adjacent units.
In order to achieve the above feature, the exemplary illustrative embodiments have features as described below.
A first aspect of the exemplary illustrative embodiment is directed to a game machine for generating a game map which defines an area where an object can move in the course of a game. The game machine includes unit storage means (which exemplarily corresponds to, in a preferred embodiment, a unit storage area 322), first disposing means (which exemplarily corresponds to, in the preferred embodiment, a CPU 31 executing steps S2 and S3; only step numbers are hereinafter shown), and second disposing means (S1, S4, S5, S6). The unit storage means has previously stored therein a first unit (passage unit PU), which is a unit zone including at least one connecting portion (door DR) and forming the game map, and a second unit (room unit RU), which is a unit zone including at least one connecting portion and is different in type from the first unit. The first disposing means selects one unit from the first unit and the second unit that are stored in the unit storage means, and disposes the selected unit on the map area. The second disposing means repeats a process of selecting a unit which is connectable to an unconnected connecting portion included in a unit already disposed on the map area and a process of disposing the selected unit on the map area. The second disposing means includes unconnected connecting portion extracting means (S4, S51, S71), random number generating means (S52), selection coefficient setting means (S1), unit selecting means (S53 through S61), and unit disposing means (S62). The unconnected connecting portion extracting means extracts the unconnected connecting portion from the connecting portions included in the unit already disposed on the map area. The random number generating means generates a random number within a predetermined range. The selection coefficient setting means sets a selection coefficient (selection coefficient SF) to the connecting portion extracted by the unconnected connecting portion extracting means. The unit selecting means compares the random number generated by the random number generating means with the selection coefficient based on predetermined criteria, and selects either one unit from the first unit and the second unit. The unit disposing means extracts the one unit selected by the unit selecting means from the first unit and the second unit stored in the unit storage means, connects a connecting portion included in the one unit to the connecting portion extracted by the unconnected connecting portion extracting means, and disposes the one unit on the map area. Here, the first unit and the second unit are units of different types, and various types of these units can be thought. In a first example, the first unit is a unit representing a passage on the game map, and the second unit is a unit representing a room. In a second example, the second unit is a unit where game components (enemy characters, items, a starting point, a goal point, etc.) can be disposed, and the first unit is a unit where such game components cannot be disposed. In a third example, the first unit is a unit having a relatively small size, and the second unit is a unit having a relatively large size. In a fourth example, the first unit and the second unit have different shapes.
According to the structure of an exemplary illustrative embodiment, it is possible to automatically generate a map with diverse elements including units of a plurality of types selected based on the random number. Also, by appropriately setting the selection coefficient, units of different types can be disposed on the map area at a desired ratio. By way of example, if the first unit is selected when the generated random number is smaller than the selection coefficient, and the selection coefficient is set so as to have a value larger than a median value of a range of possible random numbers, the ratio of disposition of the first unit on the map area is increased. Furthermore, with the selection coefficient being set as such, the possibility that a plurality of first units are successively connected for disposition is increased, and the possibility that a plurality of second units are successively connected for disposition is decreased. As such, by varying the value of the selection coefficient with respect to the range of the possible random numbers, it is possible to generate a map with diverse elements in consideration of a ratio of disposition based on the unit type and an affinity between adjacent units. Furthermore, a new unit is connected to the connecting portion of the unit that has been already disposed, thereby preventing an inconvenience of causing the map to be divided into plural areas.
For example, the first unit is a unit zone representing a passage (passage area PZ) on the game map, and the second unit is a unit zone (room zone RZ) representing a room having an area larger than an area of the first unit on the game map. With this, it is possible to generate a map with diverse elements including the rooms and the passages forming the game at a desired ratio. For example, by appropriately setting the value of the selection coefficient with respect to the range of possible random values, the possibility of generating a map in which rooms are successively connected for disposition can be decreased. Also, it is possible to reduce the possibility that additionally disposed components, such as a starting point, a goal point, enemy characters, and items, which are generally disposed in a room on the game map, are concentrated on the game map.
By way of example, the selection coefficient setting means sets different selection coefficients (selection coefficient SF×multiplication factor M) based on a type of a unit including the connecting portion extracted by the unconnected connecting portion extracting means. With this, the possibility that one of the first and second units is connected to the other unit for disposition can be controlled. For example, it is possible to generate a map in which a first unit is more likely to be connected to a second unit for disposition and a first unit and a second unit are equally likely to be connected to a second unit. That is, it is possible to generate a map in consideration of a connection affinity between units of two types. In another example, the selection coefficient setting means sets different selection coefficients based on the connecting portion extracted by the unconnected connecting portion extracting means. With this, the type of the unit connected to each connecting portion included in the unit can be controlled. Therefore, it is possible to generate a map in further consideration of an affinity between units.
Also, the unit storage means may have previously stored therein a first unit group (passage unit image group) formed by a plurality of the first units and a second unit group (room unit image group) formed by a plurality of the second units. In this case, the unit selecting means compares the random number with the selection coefficient based on the predetermined criteria, and selects one unit group from the first unit group and the second unit group. The unit disposing means then extracts a unit from the one unit group selected by the unit selecting means from the first unit group and the second unit group, and disposes the extracted unit on the map area. Thus, with a plurality of first units and second units being provided, it is possible to generate a map with further diverse elements.
For example, in some cases, the connecting portion included in the one unit selected by the unit selecting means cannot be connected to the connecting portion extracted by the unconnected connecting portion extracting means for disposing the one unit on the map area (No in step S54). In such cases, the unit disposing means may extract another one unit the first unit and the second unit (S56, S57), connect a connecting portion included in the other unit to the connecting portion extracted by the unconnected connecting portion extracting means, and dispose the other unit on the map area (S62). With this, it is possible to prevent generation of a map with a connecting portion left unconnected because no other portion can be connected to the unconnected connecting portion. Also, in some cases, the connecting portion included in the other unit cannot be connected to the connecting portion extracted by the unconnected connecting portion extracting means for disposing the other unit on the map area (No in step S56 or No in step S59). In such cases, the unit disposing means may close the connecting portion extracted by the unconnected connecting portion extracting means (cap unit CU, S58, S61, S62). With this, the connecting portion at which no unit can be disposed is closed, thereby preventing generation of a map with a connecting portion left unconnected.
Also, in one case, after the number of second units disposed by the first and second disposing means on the map area has reached a predetermined number, the second disposing means may stop disposing the second unit on the map area. In another case, third disposing means (S73, S74) may be further provided. When the number of second units disposed by the first and second disposing means on the map area has reached a predetermined number (S6), the third disposing means extracts the first unit stored in the unit storage means, connects a connecting portion included in the first unit to the connecting portion extracted by the unconnected connecting portion extracting means, and disposes the first unit on the map area. In either case, a map can be generated with the number of second units to be disposed on the map area being set. Also, when there is another unconnected connecting portion within a predetermined area (zone Z) on the map area with reference to the connecting portion extracted by the unconnected connecting portion extracting means (S72), the third disposing means may dispose the first unit to connect the extracted connecting portion and the other unconnected connecting portion together via the first unit (S73). When there is no other unconnected connecting portion within the predetermined area on the map area, the third disposing means may close the connecting portion extracted by the unconnected connecting portion extracting means (S74). With this, it is possible to prevent generation of a map with a connecting portion left unconnected. Also, when there is a plurality of unconnected connecting portions and these connecting portions are relatively close to each other, these connecting portions are connected via the first unit. Therefore, a map with diverse elements can be generated. Furthermore, a map with a predetermined number of second units being combined as one and disposed on the map area can be generated.
A second aspect of an exemplary illustrative embodiment is directed to a storage medium having stored therein a game program causing a computer to perform a process of generating a game map which defines an area where an object can move in the course of a game. The computer has previously stored therein (unit storage area 322) a first unit, which is a unit zone including at least one connecting portion and forming the game map, and a second unit, which is a unit zone including at least one connecting portion and is different in type from the first unit. The game program stored in the storage medium causes the computer to perform the process including a first disposing step (S2, S3) and a second disposing step (S1, S4, S5, S6). In the first disposing step, one unit is selected from the previously-stored first unit and the second unit, and the selected unit is disposed on the map area. In the second disposing step, a process of selecting a unit which is connectable to an unconnected connecting portion included in a unit already disposed on the map area and a process of disposing the selected unit on the map area are repeated. The second disposing step includes: an unconnected connecting portion extracting step (S4, S51, S71), a random number generating step (S52), a selection coefficient extracting step (S1), a unit selecting step (S53 through S61), and a unit disposing step (S62). In the unconnected connecting portion extracting step, the unconnected connecting portion is extracted from the connecting portions included in the unit already disposed on the map area. In the random number generating step, a random number is generated within a predetermined range. In the selection coefficient setting step, a selection coefficient is set to the connecting portion extracted in the unconnected connecting portion extracting step. In the unit selecting step, the random number generated in the random number generating step is compared with the selection coefficient based on predetermined criteria, and either one unit from the first unit and the second unit is selected. In the unit disposing step, the one unit selected in the unit selecting step is extracted from the first unit and the second unit previously stored, a connecting portion included in the one unit is connected to the connecting portion extracted in the unconnected connecting portion extracting step, and the one unit is disposed on the map area. According to the structure of the exemplary illustrative embodiment, effects similar to those obtained from the above game machine can be obtained even from a computer executing a game program stored in the storage medium.
For example, the first unit is a unit zone representing a passage on the game map, and the second unit is a unit zone representing a room having an area larger than an area of the first unit on the game map.
In one example, in the selection coefficient setting step, different selection coefficients are set based on a type of a unit including the connecting portion extracted in the unconnected connecting portion extracting step. In another example, in the selection coefficient setting step, different selection coefficients are set based on the connecting portion extracted in the unconnected connecting portion extracting step.
Also, the computer may have previously stored therein a first unit group formed by a plurality of the first units and a second unit group formed by a plurality of the second units. In this case, in the unit selecting step, the random number is compared with the selection coefficient based on the predetermined criteria, and one unit group is selected from the first unit group and the second unit group. In the unit disposing step, a unit is extracted from the one unit group selected in the unit selecting step from the first unit group and the second unit group, and the extracted unit is disposed on the map area.
For example, in some cases, the connecting portion included in the one unit selected in the unit selecting step cannot be connected to the connecting portion extracted in the unconnected connecting portion extracting step for disposing the one unit on the map area. In such cases, in the unit disposing step, another one unit may be extracted from the first unit and the second unit, a connecting portion included in the other unit may be connected to the connecting portion extracted in the unconnected connecting portion extracting step, and the other unit may be disposed on the map area. Furthermore, in some cases, the connecting portion included in the other unit cannot be connected to the connecting portion extracted in the unconnected connecting portion extracting step for disposing the other unit on the map area. In such cases, in the unit disposing step, the connecting portion extracted in the unconnected connecting portion extracting step may be closed.
In the second disposing step, after the number of second units disposed in the first and second disposing steps on the map area has reached a predetermined number, disposing the second unit on the map area may be stopped. Also, the game program may further cause the computer to perform a third disposing step (S73, S74). In the third disposing step, when the number of second units disposed in the first and second disposing steps on the map area has reached a predetermined number, the previously-stored first unit is extracted, a connecting portion included in the first unit is connected to the connecting portion extracted by the unconnected connecting portion extracting step, and the first unit is disposed on the map area. Also, in the third disposing step, when there is another unconnected connecting portion within a predetermined area on the map area with reference to the connecting portion extracted in the unconnected connecting portion extracting step, the first unit may be disposed to connect the extracted connecting portion and the other unconnected connecting portion together via the first unit. In the third disposing step, when there is no other unconnected connecting portion within the predetermined area on the map area, the connecting portion extracted in the unconnected connecting portion extracting step may be closed.